package com.tiny.persistence.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import lombok.Data;


/**
 * The persistent class for the auth_user database table.
 * 
 */
@Data
@Entity
@Table(name="bg_user")
public class BgUser implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;

	private String password;

	@Column(name="user_name")
	private String username;
	
	@Column(name="name")
	private String name;
	
	//手机号码
	@Column(name="mobile_phone")
	private String mobilePhone;
	
	//单位
	@Column(name="company")
	private String company;
	
	//单位地址
	@Column(name="address")
	private String address;
    
	//角色
    @ManyToOne()
	@JoinColumn(name="bg_role_id")
    private BgRole bgRole;
	
    //是否通过审核 0未审核1审核通过2审核不通过
    @Column(name="is_passed")
    private Integer isPassed;


    //创建时间
    @Column(name="create_time")
    private Date createTime;
    
	public BgUser() {
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BgUser other = (BgUser) obj;
		if (id != other.id)
			return false;
		return true;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}


	@Override
	public String toString() {
		return "AuthUser [id=" + id + ", password=" + password + ", username="
				+ username + ", mobilePhone=" + mobilePhone + ", company="
				+ company + ", address=" + address  
				+ ", bgRole=" + bgRole + ", isPassed=" + isPassed
				+ "]";
	}
}